﻿<%@ WebHandler Language="C#" Class="RegisterInSessionHandler" %>

using System;
using System.Web;

public class RegisterInSessionHandler : IHttpHandler, System.Web.SessionState.IRequiresSessionState
{
    
    public void ProcessRequest (HttpContext context) {
        context.Response.ContentType = "application/json";
        bool result = false;
        log4net.ILog log = log4net.LogManager.GetLogger("LogFile");
        string key = context.Request.Params["KeY"];
        string value = context.Request.Params["vAlUe"];
        System.Web.Script.Serialization.JavaScriptSerializer js = new System.Web.Script.Serialization.JavaScriptSerializer();
        if (key == null && value == null)
        {
            context.Response.Write(js.Serialize(result));
            return;
        }
        context.Session[key] = value;
        result = true;
        context.Response.Write(js.Serialize(result));
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }

}